﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using Wpf.Ui;
using Wpf.Ui.Controls;
using Wpf.Ui.Extensions;
using WpfMvvmTemplate.WPFUI.Models.Pages;

namespace WpfMvvmTemplate.WPFUI.ViewModels.Pages
{
    public partial class DashboardViewModel : ObservableObject
    {
        [ObservableProperty]
        public DashboardModel? dashboardModels;

        public DashboardViewModel()
        {
            DashboardModels = new DashboardModel();
        }

        [RelayCommand]
        private void CounterIncrement()
        {
            DashboardModels!.Counter++;
            DashboardModels.Name = "LiuChao";

            //弹框
            App.Current.Services.GetRequiredService<ISnackbarService>().Show("不要责怪自己",
                                                     "每一天都是新的开始，每一天都有无限的可能性。",
                                                     ControlAppearance.Success,
                                                     new SymbolIcon(SymbolRegular.Fluent24),
                                                     TimeSpan.FromSeconds(3));

        }

        [RelayCommand]
        private void ShowDialog()
        {
            //对话框
            var result = App.Current.Services.GetRequiredService<IContentDialogService>().ShowSimpleDialogAsync(
                   new SimpleContentDialogCreateOptions()
                   {
                       Title = "Save your work?",
                       Content = "这里是自定义Content.",
                       PrimaryButtonText = "Save",
                       //SecondaryButtonText = "Don't Save",
                       CloseButtonText = "Cancel",
                   }
             );
        }
    }
}
